import java.util.Scanner;

public class App {
    private static Scanner reader = new Scanner(System.in);

    public static void main(String[] args) throws Exception { 
        BinaryTree<String> tree = new BinaryTree<String>(reader.nextLine().split(","));
        tree.preorder();
        tree.inorder();
        tree.postorder();
        tree.levelorder();
        System.out.println(tree.level("9"));
        System.out.println(tree.height());
        System.out.println(tree.size());
        System.out.println(tree.isEmpty());
        System.out.println(tree.leaf());
        System.out.println(tree.search(Integer.toString(8)));
    }
}
